package com.zz.ecommerce.baseManage.baseDict.dao;

import com.zz.ecommerce.baseManage.baseDict.bean.BaseDictBean;
import com.zz.ecommerce.common.CommonDao;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by admin on 2016/3/31.
 */
@Repository
public interface BaseDictDao extends CommonDao {
    @Select("${sql}")
    List<BaseDictBean> qrySql(@Param("sql") final String executeSql);

    @Select("${sql}")
    int countSql(@Param("sql") final String executeSql);

    @Select("${sql}")
    BaseDictBean qryOne(@Param("sql") final String executeSql);

    @Update("update ${realTableName} set ${enableKey}='0' where ${indxKey}=#{id}")
    void deleteDict(@Param("realTableName") String realTableName, @Param("enableKey") String enableKey,
                    @Param("indxKey") String indxKey, @Param("id") String id);

    @Insert("${sql}")
    int insertBySql(@Param("sql") final String executeSql);

    @Update("${sql}")
    int updateBySql(@Param("sql") final String executeSql);
}
